package com.alphasystem.commerce.common.model.translation;

import static javax.persistence.InheritanceType.JOINED;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.alphasystem.commerce.common.model.AbstractEntity;
import com.alphasystem.commerce.common.model.locale.Country;
import com.alphasystem.commerce.common.model.locale.Language;

/**
 * @author Syed F Ali
 */
@Entity
@Table(name = "ASPC_TRANSLATION_INFO")
@Inheritance(strategy = JOINED)
public class TranslationInfo extends AbstractEntity {

	private static final long serialVersionUID = -1224601252919441898L;

	protected String content;

	protected Country country;

	protected String description;

	protected Language language;

	protected String shortDescription;

	protected String translationKey;

	public TranslationInfo() {
		super();
	}

	public TranslationInfo(String id) {
		super(id);
	}

	/**
	 * @return the content
	 */
	@Lob
	@Column(name = "CONTENT")
	public String getContent() {
		return content;
	}

	@ManyToOne
	@JoinColumn(name = "COUNTRY_ID", nullable = false, referencedColumnName = "ID")
	public Country getCountry() {
		return country;
	}

	/**
	 * @return the description
	 */
	@Column(name = "DESCRIPTION", length = 254)
	public String getDescription() {
		return description;
	}

	@ManyToOne
	@JoinColumn(name = "LANGUAGE_ID", referencedColumnName = "ID", nullable = false)
	public Language getLanguage() {
		return language;
	}

	/**
	 * @return the displayName
	 */
	@Column(name = "SHORT_DESCRIPTION", length = 20)
	public String getShortDescription() {
		return shortDescription;
	}

	@Column(name = "TRAN_KEY", length = 10, nullable = false)
	public String getTranslationKey() {
		return translationKey;
	}

	/**
	 * @param longDescription
	 *            the longDescription to set
	 */
	public void setContent(String longDescription) {
		this.content = longDescription;
	}

	/**
	 * @param country
	 */
	public void setCountry(Country country) {
		this.country = country;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param language
	 */
	public void setLanguage(Language language) {
		this.language = language;
	}

	/**
	 * @param shortDescription
	 *            the shortDescription to set
	 */
	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}

	/**
	 * @param translationKey
	 */
	public void setTranslationKey(String translationKey) {
		this.translationKey = translationKey;
	}

	@Override
	public String toString() {
		return super.toString() + ":" + shortDescription;
	}

}
